package function

import "time"

// TimeFunction 时间函数
type TimeFunction struct {
	Data   []interface{} // 存放数据
	size   int           // 数量大小
	format string        // 格式
}

func DefaultTime(format string, size int) *TimeFunction {
	return &TimeFunction{
		size:   size,
		format: format,
		Data:   make([]interface{}, size),
	}
}

func (t *TimeFunction) Build() []interface{} {
	for i := 0; i < t.size; i++ {
		t.Data[i] = time.Now().Format(t.format)
	}
	return t.Data
}
